var a = getApp();

Page({
    data: {
        language: "",
        record_id: "",
        actual_amounts: 0,
        actual_poundage: 0,
        type_name: "",
        withdraw_sn: "",
        created_at: "",
        poundage_name: "",
        actual_servicetax: 0,
        pay_way_name: "",
        name_of_withdrawal: "",
        reject_reason: "",
        amount_show: !1,
        amount_detail: {
            data: [],
            current_page: 1,
            last_page: 1,
            isLoadMore: !0
        }
    },
    onLoad: function(a) {
        a.record_id && this.setData({
            record_id: a.record_id
        }), this._getData(), this.customizeIncome(), wx.createIntersectionObserver().relativeToViewport({
            bottom: 1
        }).observe(".amount-popup-details", function(a) {
            console.log(a), a.intersectionRatio, a.intersectionRect, a.intersectionRect.left, 
            a.intersectionRect.top, a.intersectionRect.width, a.intersectionRect.height;
        });
    },
    onClose: function() {
        this.setData({
            amount_show: !1
        });
    },
    amount_dialog: function() {
        var t = this;
        this.setData({
            amount_show: !0
        });
        var e = a.getNetAddresss("finance.withdraw.incomelist");
        e += "&id=" + this.data.record_id, a._getNetWork({
            url: e,
            success: function(e) {
                if (0 == e.data.result) return a.tips(e.data.msg);
                var n = e.data.data, o = n.data, i = n.current_page, r = n.last_page;
                t.setData({
                    "amount_detail.data": o,
                    "amount_detail.current_page": i,
                    "amount_detail.last_page": r
                });
            }
        });
    },
    lower: function() {
        var t = this;
        if (!(this.data.amount_detail.current_page >= this.data.amount_detail.last_page) && this.data.amount_detail.isLoadMore) {
            var e = this.data.amount_detail.current_page + 1, n = a.getNetAddresss("finance.withdraw.incomelist");
            n += "&id=" + this.data.record_id + "&page=" + e, a._getNetWork({
                url: n,
                success: function(e) {
                    if (t.setData({
                        "amount_detail.isLoadMore": !0
                    }), 0 == e.data.result) return a.tips(e.data.msg);
                    var n = e.data.data, o = n.data, i = n.current_page, r = n.last_page;
                    t.setData({
                        "amount_detail.data": t.data.amount_detail.data.concat(o),
                        "amount_detail.current_page": i,
                        "amount_detail.last_page": r
                    });
                }
            });
        }
    },
    customizeIncome: function() {
        try {
            var a = wx.getStorageSync("mailLanguage");
            if (a) {
                var t = JSON.parse(a);
                this.setData({
                    poundage_name: t.income.poundage_name,
                    name_of_withdrawal: t.income.name_of_withdrawal
                });
            }
        } catch (a) {}
    },
    onReady: function() {
        var a = wx.getStorageSync("langIndex");
        this.setData({
            language: a.en
        });
    },
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    _getData: function() {
        var t = this, e = a.getNetAddresss("finance.withdraw.withdraw-info");
        e += "&id=" + this.data.record_id, a._getNetWork({
            url: e,
            success: function(a) {
                var e = a.data;
                if (1 == e.result) {
                    var n = e.data;
                    t.setData({
                        pay_way_name: n.pay_way_name,
                        actual_poundage: n.actual_poundage,
                        amounts: n.amounts,
                        type_name: n.type_name,
                        withdraw_sn: n.withdraw_sn,
                        created_at: n.created_at,
                        actual_amounts: n.actual_amounts,
                        actual_servicetax: n.actual_servicetax || "0.00",
                        reject_reason: n.reject_reason || ""
                    });
                } else wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1500
                });
            },
            fail: function(a) {
                console.log(a);
            }
        });
    }
});